package cn.interestingshop.dao.notice;

import cn.interestingshop.dao.BaseDao;
import cn.interestingshop.model.entity.Notice;

import java.sql.SQLException;
import java.util.List;

public class NoticeDaoImpl extends BaseDao implements NoticeDao {

    @Override
    public List<Notice> getNotice() {
        String sql = "SELECT distinct\n" +
                "t_notice.id,\n" +
                "t_notice.content\n" +
                "FROM\n" +
                "t_notice\n" +
                "ORDER BY\n" +
                "t_notice.create_time DESC\n" +
                "LIMIT 5, 5;";

        try {
            return super.getResultList(sql, new Notice(), new Object[]{});
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

        return null;
    }
}